SQL Stepping Stones For SQL Server by Phillips Julian

SQL Stepping Stones For SQL Server by Phillips Julian

Author:Phillips, Julian [Phillips, Julian]
Language: eng
Format: epub
Published: 2021-11-28T16:00:00+00:00


-- Show the suppliers that sell more than 3 different products.

Select s . SupplierName , Count ( p . ProductId ) As "Items"

From SUPPLIERS s

Join PRODUCTS p On p . SupplierId = s . SupplierID

Group By s . SupplierName

Having Count ( p . ProductId ) > 3

Order By Items Desc

go

-- List the employees who handled more than 15 orders in 1996.

Select e . FirstName + ' ' + e . LastName As Person , COUNT ( o . OrderId ) As Orders

From EMPLOYEES As e

Join ORDERS As o On e . EmployeeId = o . EmployeeId

Where DATEPART ( year , o . OrderDate ) = 1996

Group By e . FirstName , e . LastName

Having COUNT ( o . OrderId ) > 15

Order By Orders Desc

go



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.